package com.ht.psplan;

import java.io.Serializable;

/**
 * class PlanCommInfo
 * <p> station information card <br>
 * @author Dong Shufeng
 * @Date: 2006-9-25
 * @version 1.0
 */
public class PlanCommInfo implements Serializable, Comparable {

    private int id = -1;

    private String name;

    private String desc = "";

    private String stationAddress ;

    private int port;

    private String relatedDeviceId; //example: 2006-08-08 8is Auguest   

    public PlanCommInfo() {
    }

    public PlanCommInfo(int id, String name, String desc) {
        this.id = id;
        this.name = name;
        this.desc = desc;
    }

    public PlanCommInfo(int id, String name,String desc, String relatedDeviceId, String stationAddress, int port) {
        this.id = id;
        this.name = name;
        this.relatedDeviceId = relatedDeviceId;
        this.desc = desc;
        this.stationAddress = stationAddress;
        this.port = port;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    public String getStationAddress() {
        return stationAddress;
    }

    public void setStationAddress(String stationAddress) {
        this.stationAddress = stationAddress;
    }

    public int getPort() {
        return port;
    }

    public void setPort(int port) {
        this.port = port;
    }

    public String getRelatedDeviceId() {
        return relatedDeviceId;
    }

    public void setRelatedDeviceId(String relatedDeviceId) {
        this.relatedDeviceId = relatedDeviceId;
    }

    public String toString() {
        return name;
    }

    public int compareTo(Object o) {
        if(o instanceof PlanCommInfo) {
            PlanCommInfo comm = (PlanCommInfo) o;
            if(comm.getId() > this.getId())
                return -1;
            else if(comm.getId() < this.getId())
                return 1;
            else
                return 0;
        }
        return 0;
    }
}
